import { BasicColumn } from "@/components/Table";
import { roomTypeOptions } from "@/settings/roomSetting";
import { formatToDateTime } from '@/utils/dateUtil'

export const tableColumns: BasicColumn[] = [
  {
    title: '房间名称',
    dataIndex: 'roomName'
  },
  {
    title: '房间ID',
    dataIndex: 'roomId',
    width: 70,
    align: 'center'
  },
  {
    title: '房间类型',
    dataIndex: 'roomType',
    width: 80,
    align: 'center',
    customRender: ({ record }) => {
      const target = roomTypeOptions.find(item => item.value == record.roomType);
      return target ? target.label : '--';
    }
  },
  {
    title: '开始时间',
    dataIndex: 'startTime',
    customRender: ({ record }) => {
      return formatToDateTime(record.startTime);
    }
  },
  {
    title: '结束时间',
    dataIndex: 'endTime',
    customRender: ({ record }) => {
      return formatToDateTime(record.endTime);
    }
  },
  {
    title: '购买时长',
    dataIndex: 'useTime'
  },
  {
    title: '是否超出',
    dataIndex: 'isOut',
    width: 80,
    align: 'center',
    customRender: ({ record }) => {
      return record.isOut ? '是' : '否';
    }
  },
  {
    title: '计费开始时间',
    dataIndex: 'startChargeTime',
    customRender: ({ record }) => {
      return formatToDateTime(record.startChargeTime);
    }
  },
  {
    title: '计费结束时间',
    dataIndex: 'endChargeTime',
    customRender: ({ record }) => {
      return formatToDateTime(record.endChargeTime);
    }
  },
  {
    title: '超出时长',
    dataIndex: 'outTime'
  }
]